import request from '@/utils/request'
const api_name = "/chapter"

export default {
    // 根据课程id获取课程大纲信息
    getTreeList(courseId) {
        return request({
            url: `${api_name}/treelist/${courseId}`,
            method: "get",
        })
    },
    // 添加课程
    addList(data) {
        return request({
            url: `${api_name}`,
            method: 'post',
            data: data
        })
    },
    // 编辑课程
    updateList(data) {
        return request({
            url: `${api_name}/${data.id}`,
            method: 'put',
            data: data
        })
    },
    // 根据id获取内容
    getList(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get'
        })
    },
    // 删除数据
    delList(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    }
}